<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>循环</title>
    <script src="./lib/vue2.6.10.js"></script>
</head>
<body>
    <div id="app">
        <h3>迭代普通数组</h3>
        <p v-for="i in list" >{{i}}</p><hr>
        <h3>迭代对象数组</h3>
        <p v-for="item in items" >{{item.id}} --> {{item.name}}</p><hr>
        <p v-for="(item, index) in items">{{index}}:{{item.id}} --> {{item.name}}</p><hr>
        <h3>迭代对象属性</h3>
        <p v-for="(val, key) in obj">{{key}}: {{val}}</p><hr>
        <h3>迭代数</h3>
        <p v-for="i in count"> {{i}}</p>
    </div>

    <script>
        var vm = new Vue({
            el: "#app",
            data:{
                list: [1,2,3,4,5],
                items: [
                    {id:1,name:"kui"},
                    {id:2,name:"kui2"},
                    {id:5,name:"kui5"},
                    {id:6,name:"kui6"},
                ],
                obj: {
                    id: 3344,
                    name: "nnansdnd",
                    age: 43
                },
                count:5
            }
        })
    </script>
</body>
</html>